/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('starrocks', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model InstanceConfigDto {
  configKey?: string(name='configKey', example='storage_root_path'),
  configType?: string(name='configType', example='BE'),
  configValue?: string(name='configValue', example='value1'),
  nodeGroupId?: string(name='nodeGroupId', example='ng-e24924dxxxxx'),
}

model ResourceSpec {
  cu?: int32(name='cu'),
  diskNumber?: int32(name='diskNumber'),
  localStorageInstanceType?: string(name='localStorageInstanceType'),
  nodeNumber?: int32(name='nodeNumber'),
  specType?: string(name='specType'),
  storagePerformanceLevel?: string(name='storagePerformanceLevel'),
  storageSize?: int32(name='storageSize'),
}

model ModifyCuRequest {
  fastMode?: boolean(name='FastMode'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
  nodeGroupId?: string(name='NodeGroupId', description='The warehouse ID.

This parameter is required.', example='ng-3d5ce6454354****'),
  target?: int32(name='Target', description='The number of CUs to which you want to change.

Valid values:

*   4
*   8
*   16
*   32
*   64

This parameter is required.', example='4'),
}

model ModifyCuResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: long(name='Data', description='The order ID.', example='24151320976****'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid params: [instance not exists].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model ModifyCuResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyCuResponseBody(name='body'),
}

/**
 * @summary Modifies the number of CUs for a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description Before you call this operation, make sure that you understand the billing methods and [pricing](https://www.alibabacloud.com/en/product/ecs?_p_lc=1&spm=openapi-amp.newDocPublishment.0.0.47c9281fkIZGiB#pricing) of EMR Serverless StarRocks instances.
 * Before you call this operation, take note of the following items:
 * *   You can modify the number of CUs for a warehouse of only StarRocks instances of Standard Edition.
 * *   You can increase the number of disks only for warehouses of the standard specifications.
 * *   The instance must be in the Running state.
 * After you modify the number of CUs for a warehouse, the billing of CUs has the following changes:
 * *   Pay-as-you-go StarRocks instances: You are charged based on the number of CUs.
 * *   Subscription StarRocks instances: You are charged additionally based on the price difference between the number of CUs before and after the change and the remaining days of the billing cycle. The billing cycle starts from 00:00 the next day until the end of the subscription period.
 *
 * @param request ModifyCuRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyCuResponse
 */
async function modifyCuWithOptions(request: ModifyCuRequest, headers: map[string]string, runtime: $RuntimeOptions): ModifyCuResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.fastMode)) {
    query['FastMode'] = request.fastMode;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.nodeGroupId)) {
    query['NodeGroupId'] = request.nodeGroupId;
  }
  if (!$isNull(request.target)) {
    query['Target'] = request.target;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyCu',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/resourceChange/modifyCu`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the number of CUs for a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description Before you call this operation, make sure that you understand the billing methods and [pricing](https://www.alibabacloud.com/en/product/ecs?_p_lc=1&spm=openapi-amp.newDocPublishment.0.0.47c9281fkIZGiB#pricing) of EMR Serverless StarRocks instances.
 * Before you call this operation, take note of the following items:
 * *   You can modify the number of CUs for a warehouse of only StarRocks instances of Standard Edition.
 * *   You can increase the number of disks only for warehouses of the standard specifications.
 * *   The instance must be in the Running state.
 * After you modify the number of CUs for a warehouse, the billing of CUs has the following changes:
 * *   Pay-as-you-go StarRocks instances: You are charged based on the number of CUs.
 * *   Subscription StarRocks instances: You are charged additionally based on the price difference between the number of CUs before and after the change and the remaining days of the billing cycle. The billing cycle starts from 00:00 the next day until the end of the subscription period.
 *
 * @param request ModifyCuRequest
 * @return ModifyCuResponse
 */
async function modifyCu(request: ModifyCuRequest): ModifyCuResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyCuWithOptions(request, headers, runtime);
}

model ModifyCuPreCheckRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
  nodeGroupId?: string(name='NodeGroupId', description='The warehouse ID.

This parameter is required.', example='ng-d332aa8bca48****'),
  target?: int32(name='Target', description='The number of CUs to which you want to change.

Valid values:

*   2
*   4
*   8
*   16
*   32
*   64

This parameter is required.', example='2'),
}

model ModifyCuPreCheckResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: {
    allow?: boolean(name='Allow', description='Indicates whether the number of CUs can be modified.', example='false'),
    reason?: string(name='Reason', description='The reason why the number of CUs cannot be modified.', example='Failed to find node group[ng-3d5ce6454354****].'),
  }(name='Data', description='The returned data.'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid params: [instance not exists].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model ModifyCuPreCheckResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyCuPreCheckResponseBody(name='body'),
}

/**
 * @summary Performs a precheck before you modify the number of CUs for a warehouse.
 *
 * @param request ModifyCuPreCheckRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyCuPreCheckResponse
 */
async function modifyCuPreCheckWithOptions(request: ModifyCuPreCheckRequest, headers: map[string]string, runtime: $RuntimeOptions): ModifyCuPreCheckResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.nodeGroupId)) {
    query['NodeGroupId'] = request.nodeGroupId;
  }
  if (!$isNull(request.target)) {
    query['Target'] = request.target;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyCuPreCheck',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/resourceChange/modifyCuPreCheck`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Performs a precheck before you modify the number of CUs for a warehouse.
 *
 * @param request ModifyCuPreCheckRequest
 * @return ModifyCuPreCheckResponse
 */
async function modifyCuPreCheck(request: ModifyCuPreCheckRequest): ModifyCuPreCheckResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyCuPreCheckWithOptions(request, headers, runtime);
}

model ModifyDiskNumberRequest {
  fastMode?: boolean(name='FastMode'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
  nodeGroupId?: string(name='NodeGroupId', description='The warehouse ID.

This parameter is required.', example='ng-3d5ce6454354****'),
  target?: int32(name='Target', description='The number of disks to which you want to change to.

This parameter is required.', example='3'),
}

model ModifyDiskNumberResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: long(name='Data', description='The order ID.', example='24151320976****'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid params: [instance not exists].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model ModifyDiskNumberResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDiskNumberResponseBody(name='body'),
}

/**
 * @summary Increases the number of disks for a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description Before you call this operation, make sure that you understand the billing methods and [pricing](https://www.alibabacloud.com/en/product/ecs?_p_lc=1&spm=openapi-amp.newDocPublishment.0.0.47c9281fkIZGiB#pricing) of EMR Serverless StarRocks instances. Before you call this operation, take note of the following items:
 * *   You can increase the number of disks only for StarRocks instances of Standard Edition.
 * *   You can increase the number of disks only for warehouses of the standard specifications.
 * *   The instance must be in the Running state.
 * After you increase the number of disks for a warehouse, the billing of disks has the following changes:
 * *   Pay-as-you-go StarRocks instances: You are charged for the disk based on the new disk type.
 * *   Subscription StarRocks instances: You are charged additionally based on the price difference between the number of disks before and after the change and the remaining days of the billing cycle. The billing cycle starts from 00:00 the next day until the end of the subscription period.
 *
 * @param request ModifyDiskNumberRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDiskNumberResponse
 */
async function modifyDiskNumberWithOptions(request: ModifyDiskNumberRequest, headers: map[string]string, runtime: $RuntimeOptions): ModifyDiskNumberResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.fastMode)) {
    query['FastMode'] = request.fastMode;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.nodeGroupId)) {
    query['NodeGroupId'] = request.nodeGroupId;
  }
  if (!$isNull(request.target)) {
    query['Target'] = request.target;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDiskNumber',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/resourceChange/modifyDiskNumber`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Increases the number of disks for a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description Before you call this operation, make sure that you understand the billing methods and [pricing](https://www.alibabacloud.com/en/product/ecs?_p_lc=1&spm=openapi-amp.newDocPublishment.0.0.47c9281fkIZGiB#pricing) of EMR Serverless StarRocks instances. Before you call this operation, take note of the following items:
 * *   You can increase the number of disks only for StarRocks instances of Standard Edition.
 * *   You can increase the number of disks only for warehouses of the standard specifications.
 * *   The instance must be in the Running state.
 * After you increase the number of disks for a warehouse, the billing of disks has the following changes:
 * *   Pay-as-you-go StarRocks instances: You are charged for the disk based on the new disk type.
 * *   Subscription StarRocks instances: You are charged additionally based on the price difference between the number of disks before and after the change and the remaining days of the billing cycle. The billing cycle starts from 00:00 the next day until the end of the subscription period.
 *
 * @param request ModifyDiskNumberRequest
 * @return ModifyDiskNumberResponse
 */
async function modifyDiskNumber(request: ModifyDiskNumberRequest): ModifyDiskNumberResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyDiskNumberWithOptions(request, headers, runtime);
}

model ModifyDiskPerformanceLevelRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
  nodeGroupId?: string(name='NodeGroupId', description='The warehouse ID.

This parameter is required.', example='ng-3d5ce6454354****'),
  target?: string(name='Target', description='The disk performance level to which you want to change.

Valid values:

*   pl0
*   pl1
*   pl2
*   pl3

This parameter is required.', example='pl2'),
}

model ModifyDiskPerformanceLevelResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: long(name='Data', description='The order ID.', example='24151320976****'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid params: [instance not exists].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model ModifyDiskPerformanceLevelResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDiskPerformanceLevelResponseBody(name='body'),
}

/**
 * @summary Modifies the disk performance level for a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description Before you call this operation, make sure that you understand the billing methods and [pricing](https://www.alibabacloud.com/en/product/ecs?_p_lc=1&spm=openapi-amp.newDocPublishment.0.0.47c9281fkIZGiB#pricing) of EMR Serverless StarRocks instances.
 * Before you call this operation, take note of the following items:
 * *   You can modify the disk performance level only for StarRocks instances of Standard Edition.
 * *   You can modify the disk performance level only for warehouses of the standard specifications.
 * *   The instance must be in the Running state.
 * *   You cannot downgrade the performance level to PL0.
 * *   The performance level of an Enterprise SSD (ESSD) is limited by the ESSD disk size. If you cannot upgrade the performance level of an ESSD, expand the ESSD and try again. For more information, see [Enterprise SSDs](https://help.aliyun.com/document_detail/122389.html).
 * After the disk performance level is changed, the billing of the disk has the following changes:
 * *   Pay-as-you-go StarRocks instances: You are charged for the disk based on the new disk type.
 * *   Subscription StarRocks instances: You are charged additionally based on the price difference between the disk performance level before and sfter the change and the remaining days of the billing cycle. The billing cycle starts from 00:00 the next day until the end of the subscription period.
 *
 * @param request ModifyDiskPerformanceLevelRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDiskPerformanceLevelResponse
 */
async function modifyDiskPerformanceLevelWithOptions(request: ModifyDiskPerformanceLevelRequest, headers: map[string]string, runtime: $RuntimeOptions): ModifyDiskPerformanceLevelResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.nodeGroupId)) {
    query['NodeGroupId'] = request.nodeGroupId;
  }
  if (!$isNull(request.target)) {
    query['Target'] = request.target;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDiskPerformanceLevel',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/resourceChange/modifyDiskPerformanceLevel`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the disk performance level for a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description Before you call this operation, make sure that you understand the billing methods and [pricing](https://www.alibabacloud.com/en/product/ecs?_p_lc=1&spm=openapi-amp.newDocPublishment.0.0.47c9281fkIZGiB#pricing) of EMR Serverless StarRocks instances.
 * Before you call this operation, take note of the following items:
 * *   You can modify the disk performance level only for StarRocks instances of Standard Edition.
 * *   You can modify the disk performance level only for warehouses of the standard specifications.
 * *   The instance must be in the Running state.
 * *   You cannot downgrade the performance level to PL0.
 * *   The performance level of an Enterprise SSD (ESSD) is limited by the ESSD disk size. If you cannot upgrade the performance level of an ESSD, expand the ESSD and try again. For more information, see [Enterprise SSDs](https://help.aliyun.com/document_detail/122389.html).
 * After the disk performance level is changed, the billing of the disk has the following changes:
 * *   Pay-as-you-go StarRocks instances: You are charged for the disk based on the new disk type.
 * *   Subscription StarRocks instances: You are charged additionally based on the price difference between the disk performance level before and sfter the change and the remaining days of the billing cycle. The billing cycle starts from 00:00 the next day until the end of the subscription period.
 *
 * @param request ModifyDiskPerformanceLevelRequest
 * @return ModifyDiskPerformanceLevelResponse
 */
async function modifyDiskPerformanceLevel(request: ModifyDiskPerformanceLevelRequest): ModifyDiskPerformanceLevelResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyDiskPerformanceLevelWithOptions(request, headers, runtime);
}

model ModifyDiskSizeRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
  nodeGroupId?: string(name='NodeGroupId', description='The warehouse ID.

This parameter is required.', example='ng-3d5ce6454354****'),
  target?: int32(name='Target', description='The disk size to which you want to change to. Unit: GB.

This parameter is required.', example='500'),
}

model ModifyDiskSizeResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: long(name='Data', description='The order ID.', example='24151320976****'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid params: [instance not exists].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model ModifyDiskSizeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDiskSizeResponseBody(name='body'),
}

/**
 * @summary Expands the disk size for a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description Before you call this operation, make sure that you understand the billing methods and [pricing](https://www.alibabacloud.com/en/product/ecs?_p_lc=1&spm=openapi-amp.newDocPublishment.0.0.47c9281fkIZGiB#pricing) of EMR Serverless StarRocks instances. Before you call this operation, take note of the following items:
 * *   You can expand the disk size only for StarRocks instances of Standard Edition.
 * *   You can expand the disk size only for warehouses of the standard specifications.
 * *   The instance must be in the Running state.
 * After you expand the disk size, the billing of disks has the following changes:
 * *   Pay-as-you-go StarRocks instances: You are charged for the disk based on the new disk size.
 * *   Subscription StarRocks instances: You are charged additionally based on the price difference between the disk size before and after the change and the remaining days of the billing cycle. The billing cycle starts from 00:00 the next day until the end of the subscription period.
 *
 * @param request ModifyDiskSizeRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDiskSizeResponse
 */
async function modifyDiskSizeWithOptions(request: ModifyDiskSizeRequest, headers: map[string]string, runtime: $RuntimeOptions): ModifyDiskSizeResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.nodeGroupId)) {
    query['NodeGroupId'] = request.nodeGroupId;
  }
  if (!$isNull(request.target)) {
    query['Target'] = request.target;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDiskSize',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/resourceChange/modifyDiskSize`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Expands the disk size for a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description Before you call this operation, make sure that you understand the billing methods and [pricing](https://www.alibabacloud.com/en/product/ecs?_p_lc=1&spm=openapi-amp.newDocPublishment.0.0.47c9281fkIZGiB#pricing) of EMR Serverless StarRocks instances. Before you call this operation, take note of the following items:
 * *   You can expand the disk size only for StarRocks instances of Standard Edition.
 * *   You can expand the disk size only for warehouses of the standard specifications.
 * *   The instance must be in the Running state.
 * After you expand the disk size, the billing of disks has the following changes:
 * *   Pay-as-you-go StarRocks instances: You are charged for the disk based on the new disk size.
 * *   Subscription StarRocks instances: You are charged additionally based on the price difference between the disk size before and after the change and the remaining days of the billing cycle. The billing cycle starts from 00:00 the next day until the end of the subscription period.
 *
 * @param request ModifyDiskSizeRequest
 * @return ModifyDiskSizeResponse
 */
async function modifyDiskSize(request: ModifyDiskSizeRequest): ModifyDiskSizeResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyDiskSizeWithOptions(request, headers, runtime);
}

model ModifyNodeNumberRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
  nodeGroupId?: string(name='NodeGroupId', description='The warehouse ID.

This parameter is required.', example='ng-3d5ce6454354****'),
  target?: int32(name='Target', description='The number of nodes to which you want to change to.

This parameter is required.', example='3'),
}

model ModifyNodeNumberResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: long(name='Data', description='The order ID.', example='24151320976****'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid params: [instance not exists].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model ModifyNodeNumberResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyNodeNumberResponseBody(name='body'),
}

/**
 * @summary Modifies the number of nodes in a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description Before you call this operation, make sure that you understand the billing methods and [pricing](https://www.alibabacloud.com/en/product/ecs?_p_lc=1&spm=openapi-amp.newDocPublishment.0.0.47c9281fkIZGiB#pricing) of EMR Serverless StarRocks instances.
 * Before you call this operation, take note of the following items:
 * *   You can modify the number of nodes in a warehouse of only StarRocks instances of Standard Edition.
 * *   The instance must be in the Running state.
 * *   The number of frontend nodes (FEs) cannot be an even number, and you cannot reduce the number of FE nodes.
 * After you modify the number of nodes in a warehouse, the billing of nodes has the following changes:
 * *   Pay-as-you-go StarRocks instances: You are charged based on the number of nodes.
 * *   Subscription StarRocks instances: You are charged additionally based on the price difference between the number of nodes before and after the change and the remaining days of the billing cycle. The billing cycle starts from 00:00 the next day until the end of the subscription period.
 *
 * @param request ModifyNodeNumberRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyNodeNumberResponse
 */
async function modifyNodeNumberWithOptions(request: ModifyNodeNumberRequest, headers: map[string]string, runtime: $RuntimeOptions): ModifyNodeNumberResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.nodeGroupId)) {
    query['NodeGroupId'] = request.nodeGroupId;
  }
  if (!$isNull(request.target)) {
    query['Target'] = request.target;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyNodeNumber',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/resourceChange/modifyNodeNumber`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the number of nodes in a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description Before you call this operation, make sure that you understand the billing methods and [pricing](https://www.alibabacloud.com/en/product/ecs?_p_lc=1&spm=openapi-amp.newDocPublishment.0.0.47c9281fkIZGiB#pricing) of EMR Serverless StarRocks instances.
 * Before you call this operation, take note of the following items:
 * *   You can modify the number of nodes in a warehouse of only StarRocks instances of Standard Edition.
 * *   The instance must be in the Running state.
 * *   The number of frontend nodes (FEs) cannot be an even number, and you cannot reduce the number of FE nodes.
 * After you modify the number of nodes in a warehouse, the billing of nodes has the following changes:
 * *   Pay-as-you-go StarRocks instances: You are charged based on the number of nodes.
 * *   Subscription StarRocks instances: You are charged additionally based on the price difference between the number of nodes before and after the change and the remaining days of the billing cycle. The billing cycle starts from 00:00 the next day until the end of the subscription period.
 *
 * @param request ModifyNodeNumberRequest
 * @return ModifyNodeNumberResponse
 */
async function modifyNodeNumber(request: ModifyNodeNumberRequest): ModifyNodeNumberResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyNodeNumberWithOptions(request, headers, runtime);
}

model ModifyNodeNumberPreCheckRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
  nodeGroupId?: string(name='NodeGroupId', description='The warehouse ID.

This parameter is required.', example='ng-3d5ce6454354****'),
  target?: int32(name='Target', description='The number of nodes to which you want to change to.

This parameter is required.', example='3'),
}

model ModifyNodeNumberPreCheckResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: {
    allow?: boolean(name='Allow', description='Indicates whether the number of nodes can be modified.', example='true'),
    reason?: string(name='Reason', description='The reason why the number of nodes cannot be modified.', example='Failed to find node group[ng-3d5ce6454354****].'),
  }(name='Data', description='The returned data.'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid params: [instance not exists].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model ModifyNodeNumberPreCheckResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyNodeNumberPreCheckResponseBody(name='body'),
}

/**
 * @summary Performs a precheck before you modify the number of nodes in a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @param request ModifyNodeNumberPreCheckRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyNodeNumberPreCheckResponse
 */
async function modifyNodeNumberPreCheckWithOptions(request: ModifyNodeNumberPreCheckRequest, headers: map[string]string, runtime: $RuntimeOptions): ModifyNodeNumberPreCheckResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.nodeGroupId)) {
    query['NodeGroupId'] = request.nodeGroupId;
  }
  if (!$isNull(request.target)) {
    query['Target'] = request.target;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyNodeNumberPreCheck',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/resourceChange/modifyNodeNumberPreCheck`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Performs a precheck before you modify the number of nodes in a warehouse of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @param request ModifyNodeNumberPreCheckRequest
 * @return ModifyNodeNumberPreCheckResponse
 */
async function modifyNodeNumberPreCheck(request: ModifyNodeNumberPreCheckRequest): ModifyNodeNumberPreCheckResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyNodeNumberPreCheckWithOptions(request, headers, runtime);
}

model QueryUpgradableVersionsRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
  minor?: boolean(name='Minor', description='Specifies whether to query the minor versions that you can upgrade to. Default value: true. Valid values:

*   true: The minor versions that you can upgrade to.
*   false: The major versions that you can upgrade to.', example='true'),
}

model QueryUpgradableVersionsResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: [ string ](name='Data', description='The versions that you can upgrade to.'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid params: [instance not exists].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model QueryUpgradableVersionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryUpgradableVersionsResponseBody(name='body'),
}

/**
 * @summary Queries the versions of an E-MapReduce (EMR) Serverless StarRocks instance that the versions that you can upgrade to. The versions of a StarRocks instance include the major version and minor version. You can view the major version and minor version of a StarRocks instance in the Version Information section of the Instance Details tab in the EMR console. You can call this operation to query the minor versions or major versions that the versions that you can upgrade to.
 *
 * @param request QueryUpgradableVersionsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryUpgradableVersionsResponse
 */
async function queryUpgradableVersionsWithOptions(request: QueryUpgradableVersionsRequest, headers: map[string]string, runtime: $RuntimeOptions): QueryUpgradableVersionsResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.minor)) {
    query['Minor'] = request.minor;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'QueryUpgradableVersions',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/starrocks/queryUpgradableVersions`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the versions of an E-MapReduce (EMR) Serverless StarRocks instance that the versions that you can upgrade to. The versions of a StarRocks instance include the major version and minor version. You can view the major version and minor version of a StarRocks instance in the Version Information section of the Instance Details tab in the EMR console. You can call this operation to query the minor versions or major versions that the versions that you can upgrade to.
 *
 * @param request QueryUpgradableVersionsRequest
 * @return QueryUpgradableVersionsResponse
 */
async function queryUpgradableVersions(request: QueryUpgradableVersionsRequest): QueryUpgradableVersionsResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return queryUpgradableVersionsWithOptions(request, headers, runtime);
}

model ReleaseInstanceRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
}

model ReleaseInstanceResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: boolean(name='Data', description='The returned data.'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid params: [instance not exists].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model ReleaseInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleaseInstanceResponseBody(name='body'),
}

/**
 * @summary Releases a pay-as-you-go E-MapReduce (EMR) Serverless StarRocks instance. To unsubscribe from a subscription instance, go to the Unsubscribe page of the Expenses and Costs console.
 *
 * @description **
 * **Warning:** After an instance is released, all physical resources used by the instance are recycled. Relevant data is erased and cannot be restored.
 *
 * @param request ReleaseInstanceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleaseInstanceResponse
 */
async function releaseInstanceWithOptions(request: ReleaseInstanceRequest, headers: map[string]string, runtime: $RuntimeOptions): ReleaseInstanceResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ReleaseInstance',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/cluster/release`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Releases a pay-as-you-go E-MapReduce (EMR) Serverless StarRocks instance. To unsubscribe from a subscription instance, go to the Unsubscribe page of the Expenses and Costs console.
 *
 * @description **
 * **Warning:** After an instance is released, all physical resources used by the instance are recycled. Relevant data is erased and cannot be restored.
 *
 * @param request ReleaseInstanceRequest
 * @return ReleaseInstanceResponse
 */
async function releaseInstance(request: ReleaseInstanceRequest): ReleaseInstanceResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return releaseInstanceWithOptions(request, headers, runtime);
}

model RestartInstanceRequest {
  fastMode?: boolean(name='FastMode', description='Specifies whether to restart compute nodes in quick restart mode. Default value: false. Valid values:

*   true: Compute nodes are restarted in quick restart mode in multiple batches. The batches are executed in parallel, and the nodes in each batch are restarted at the same time.
*   false: Compute nodes are restarted in rolling restart mode.', example='true'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
}

model RestartInstanceResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: boolean(name='Data', description='The returned data.'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Unsupported.Non.Whitelist.Operation'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model RestartInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RestartInstanceResponseBody(name='body'),
}

/**
 * @summary Restarts an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description This operation is an asynchronous operation. After you call this operation to restart a StarRocks instance, the operation sets the status of the instance to Restarting and begins the restart process. When the status of the instance changes to Running, the instance is restarted.
 *
 * @param request RestartInstanceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RestartInstanceResponse
 */
async function restartInstanceWithOptions(request: RestartInstanceRequest, headers: map[string]string, runtime: $RuntimeOptions): RestartInstanceResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.fastMode)) {
    query['FastMode'] = request.fastMode;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'RestartInstance',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/starrocks/restartCluster`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Restarts an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @description This operation is an asynchronous operation. After you call this operation to restart a StarRocks instance, the operation sets the status of the instance to Restarting and begins the restart process. When the status of the instance changes to Running, the instance is restarted.
 *
 * @param request RestartInstanceRequest
 * @return RestartInstanceResponse
 */
async function restartInstance(request: RestartInstanceRequest): RestartInstanceResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return restartInstanceWithOptions(request, headers, runtime);
}

model UpdateInstanceNameRequest {
  clusterName?: string(name='ClusterName', description='The new name of the instance.

This parameter is required.', example='new_name'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
}

model UpdateInstanceNameResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: boolean(name='Data', description='The returned data.'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid params: [instance not exists].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model UpdateInstanceNameResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateInstanceNameResponseBody(name='body'),
}

/**
 * @summary Modifies the name of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @param request UpdateInstanceNameRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateInstanceNameResponse
 */
async function updateInstanceNameWithOptions(request: UpdateInstanceNameRequest, headers: map[string]string, runtime: $RuntimeOptions): UpdateInstanceNameResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.clusterName)) {
    query['ClusterName'] = request.clusterName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateInstanceName',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/cluster/update_name`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the name of an E-MapReduce (EMR) Serverless StarRocks instance.
 *
 * @param request UpdateInstanceNameRequest
 * @return UpdateInstanceNameResponse
 */
async function updateInstanceName(request: UpdateInstanceNameRequest): UpdateInstanceNameResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return updateInstanceNameWithOptions(request, headers, runtime);
}

model UpgradeVersionRequest {
  fastMode?: boolean(name='FastMode'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='c-b25e21e24388****'),
  minor?: boolean(name='Minor', description='Specifies whether the minor version is upgraded. Default value: true. Valid values:

*   true: The minor version is upgraded.
*   false: The major version is upgraded.', example='true'),
  targetVersion?: string(name='TargetVersion', description='The version to which you want to upgrade.

This parameter is required.', example='3.3.2-1.77-1.6.4'),
}

model UpgradeVersionResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The detailed information about the failed permission verification.', example='{     "PolicyType": "AccountLevelIdentityBasedPolicy",     "AuthPrincipalOwnerId": "xxx",     "EncodedDiagnosticMessage": "xxx",     "AuthPrincipalType": "xxx",     "AuthPrincipalDisplayName": "xxx",     "NoPermissionType": "ImplicitDeny",     "AuthAction": "sr:xxx"   }'),
  data?: boolean(name='Data', description='The returned data.'),
  errCode?: string(name='ErrCode', description='The error code.', example='InvalidParams'),
  errMessage?: string(name='ErrMessage', description='The error message.', example='Invalid instance status: [cannot upgrade when instance is not running].'),
  httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='32A44F0D-BFF6-5664-999A-218BBDE7****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='false'),
}

model UpgradeVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeVersionResponseBody(name='body'),
}

/**
 * @summary Upgrades the version of an E-MapReduce (EMR) Serverless StarRocks instance. The versions of a StarRocks instance include the major version and minor version. You can view the major version and minor version of a StarRocks instance in the Version Information section of the Instance Details tab in the EMR console. This operation can be used to upgrade the minor version or major version of a StarRocks instance. You can call the QueryUpgradableVersions operation to query the versions that you can upgrade to.
 *
 * @description The instance must be in the Running state when you call this operation.
 *
 * @param request UpgradeVersionRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeVersionResponse
 */
async function upgradeVersionWithOptions(request: UpgradeVersionRequest, headers: map[string]string, runtime: $RuntimeOptions): UpgradeVersionResponse {
  request.validate();
  var query : map[string]any = {};
  if (!$isNull(request.fastMode)) {
    query['FastMode'] = request.fastMode;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.minor)) {
    query['Minor'] = request.minor;
  }
  if (!$isNull(request.targetVersion)) {
    query['TargetVersion'] = request.targetVersion;
  }

  var req = new OpenApiUtil.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpgradeVersion',
    version = '2022-10-19',
    protocol = 'HTTPS',
    pathname = `/webapi/starrocks/upgradeVersion`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Upgrades the version of an E-MapReduce (EMR) Serverless StarRocks instance. The versions of a StarRocks instance include the major version and minor version. You can view the major version and minor version of a StarRocks instance in the Version Information section of the Instance Details tab in the EMR console. This operation can be used to upgrade the minor version or major version of a StarRocks instance. You can call the QueryUpgradableVersions operation to query the versions that you can upgrade to.
 *
 * @description The instance must be in the Running state when you call this operation.
 *
 * @param request UpgradeVersionRequest
 * @return UpgradeVersionResponse
 */
async function upgradeVersion(request: UpgradeVersionRequest): UpgradeVersionResponse {
  var runtime = new $RuntimeOptions{};
  var headers : map[string]string = {};
  return upgradeVersionWithOptions(request, headers, runtime);
}

